import http from "@/api";
import {
  Transit,
  TransitDelivery,
  TransitDetail,
  TransitManage,
  TransitPicker,
  TransitStage,
  TransitVehicle
} from "@/api/interface/city/cityTransit";
// 中转仓模块
// 列表
export const getCityTransitListAPI = (params: Transit.Params) => {
  return http.get<Transit.Row[]>("/manager/transitWarehouse/list", params);
};
// 详情
export const getCityTransitDetailAPI = (id: number) => {
  return http.get<TransitDetail.Data>(`/manager/transitWarehouse/${id}`);
};
// 修改中转仓时间
export const updateCityTransitTimeAPI = (data: Transit.UpdateTime) => {
  return http.put(`/manager/transitWarehouse`, data);
};
// 可选中转仓经理列表
export const getCityTransitManagerListAPI = (params: TransitManage.CanParams) => {
  return http.get<TransitManage.CanList[]>("/manager/transitWarehouse/stationMaster/list", params);
};
// 绑定中转仓经理
export const bindCityTransitManagerAPI = (data: { id: string; userId: string }) => {
  return http.post("/manager/transitWarehouse/relateMaster", data);
};
// 移除中转仓经理
export const removeCityTransitManagerAPI = (data: { id: string }) => {
  return http.post(`/manager/transitWarehouse/unRelateMaster`, data);
};

// 可选驿站列表
export const getCityTransitStationListAPI = (params: TransitStage.Params) => {
  return http.get<TransitStage.Row[]>("/manager/transitWarehouse/stationList", params);
};
// 关联驿站
export const relateCityTransitStationAPI = (data: { id: string; stageId: string }) => {
  return http.post("/manager/transitWarehouse/relateStation", data);
};
// 解除关联驿站
export const unRelateCityTransitStationAPI = (stageId: string, stationId: string) => {
  return http.get(`/manager/transitWarehouse/unRelateStation/${stageId}/${stationId}`);
};

// 可选车辆列表
export const getCityTransitVehicleListAPI = (params: TransitVehicle.Params) => {
  return http.get<TransitVehicle.Row[]>("/manager/transitWarehouse/vehicleList", params);
};
// 关联车辆
export const relateCityTransitVehicleAPI = (data: { id: string; vehicleId: string }) => {
  return http.post("/manager/transitWarehouse/relateVehicle", data);
};
// 解除关联车辆
export const unRelateCityTransitVehicleAPI = (vehicleId: string, stationId: string) => {
  return http.get(`/manager/transitWarehouse/unRelateVehicle/${vehicleId}/${stationId}`);
};

// 可选配送员
export const getCityTransitDeliveryListAPI = (params: TransitDelivery.Params) => {
  return http.get<TransitDelivery.Row[]>("/manager/transitWarehouse/relateDeliveryList", params);
};
// 关联配送员
export const relateCityTransitDeliveryAPI = (data: { id: string; userId: string }) => {
  return http.post("/manager/transitWarehouse/relateDelivery", data);
};
// 解除关联配送员
export const unRelateCityTransitDeliveryAPI = (data: { id: string }) => {
  return http.post(`/manager/transitWarehouse/unRelateDelivery`, data);
};

// 可选分拣员
export const getCityTransitSortListAPI = (params: TransitPicker.Params) => {
  return http.get<TransitPicker.Row[]>("/manager/transitWarehouse/pickerList", params);
};
// 关联分拣员
export const relateCityTransitSortAPI = (data: { id: string; userId: string }) => {
  return http.post("/manager/transitWarehouse/relatePicker", data);
};
// 解除关联分拣员
export const unRelateCityTransitSortAPI = (userId: string, id: string) => {
  return http.post(`/manager/transitWarehouse/unRelatePicker/${userId}/${id}`);
};
